<?php include _include(APP_PATH.'view/htm/header.inc.htm');?>
<div class="layui-card">
  <div class="layui-card-header">用户登录</div>
  <div class="layui-card-body">

  <div class="layui-form-item">
    <label class="layui-form-label">邀请码</label>
    <div class="layui-input-inline">
      <input type="text" id="code" required lay-verify="required" placeholder="邀请码" autocomplete="off" class="layui-input"   >
    </div>
    <div class="layui-form-mid layui-word-aux"> <a href="https://www.jianguofaka.com/details/40918908" target="_blank">点击购买邀请码</a></div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">邮箱</label>
    <div class="layui-input-inline">
      <input type="text" id="email" required lay-verify="required" placeholder="请输入邮箱" autocomplete="off" class="layui-input" lay-verify="email"  >
    </div>
    <div class="layui-form-mid layui-word-aux">邮箱</div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">用户名</label>
    <div class="layui-input-inline">
      <input type="text" id="username" required lay-verify="required" placeholder="请输入邮箱" autocomplete="off" class="layui-input"	>
    </div>
    <div class="layui-form-mid layui-word-aux">用户名</div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">密码</label>
    <div class="layui-input-inline">
      <input type="password" id="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
    </div>
    <div class="layui-form-mid layui-word-aux">密码</div>
  </div>
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit id="btn">立即注册</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
      <a href="/user-login.htm"> [已有账号？点击登录]</a>
    </div>
  </div>
  </div>
</div>
<?php include _include(APP_PATH.'view/htm/footer.inc.htm');?>
<script src="plugin/di_blogs/overwrite/view/layui/layui.js"></script>
<script src="view/js/xiuno.js"></script>
<script src="view/js/md5.js"></script>
<script>
//Demo
layui.use(['form','layer'], function(){
  var form = layui.form;
  var layer = layui.layer;

  //监听提交
	$("#btn").click(function(){
    layer.msg('注册中请稍等....');
		var data={
       code:$('#code').val(),
       email:$('#email').val(),
			 username:$('#username').val(),
			 password:$.md5($('#password').val()),
		};
		$.post('/<?php echo url('user-create');?>',data,function(res){
	    if(res.code == 0){
	       	layer.msg('注册成功,即将跳转');
	       		window.location.href='./index.htm';
	       	}else{
	       		layer.msg(res.message);
	       		 }
	   		 },"JSON");
	  });

});
</script>
